/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "OderFood", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "OderFood.findAll", query = "SELECT o FROM OderFood o"),
    @NamedQuery(name = "OderFood.findReportOrder", query = "SELECT o FROM OderFood o WHERE o.dateTime >= :fromdate AND o.dateTime <= :todate"),
    @NamedQuery(name = "OderFood.findByOderFoodID", query = "SELECT o FROM OderFood o WHERE o.oderFoodID = :oderFoodID"),
    @NamedQuery(name = "OderFood.findByDateTime", query = "SELECT o FROM OderFood o WHERE o.dateTime = :dateTime"),
    @NamedQuery(name = "OderFood.findByTotalPrice", query = "SELECT o FROM OderFood o WHERE o.totalPrice = :totalPrice"),
    @NamedQuery(name = "OderFood.findByStatus", query = "SELECT o FROM OderFood o WHERE o.status = :status")})
public class OderFood implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Basic(optional = false)
    @Column(name = "OderFoodID", nullable = false)
    private Integer oderFoodID;
    @Basic(optional = false)
    @Column(name = "DateTime", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateTime;
    @Basic(optional = false)
    @Column(name = "TotalPrice", nullable = false, precision = 19, scale = 4)
    private double totalPrice;
    @Basic(optional = false)
    @Column(name = "Status", nullable = false)
    private boolean status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "oderFood")
    private List<OrderFoodDetails> orderFoodDetailsList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "oderFood")
    private List<CancelOrderFood> cancelOrderFoodList;
    @JoinColumn(name = "CustID", referencedColumnName = "CustID", nullable = false)
    @ManyToOne(optional = false)
    private Customers customers;

    public OderFood() {
    }

    public OderFood(Integer oderFoodID) {
        this.oderFoodID = oderFoodID;
    }

    public OderFood(Integer oderFoodID, Date dateTime, double totalPrice, boolean status) {
        this.oderFoodID = oderFoodID;
        this.dateTime = dateTime;
        this.totalPrice = totalPrice;
        this.status = status;
    }

    public Integer getOderFoodID() {
        return oderFoodID;
    }

    public void setOderFoodID(Integer oderFoodID) {
        this.oderFoodID = oderFoodID;
    }

    public Date getDateTime() {
        return dateTime;
    }

    public void setDateTime(Date dateTime) {
        this.dateTime = dateTime;
    }

    public double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(double totalPrice) {
        this.totalPrice = totalPrice;
    }

    

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public List<OrderFoodDetails> getOrderFoodDetailsList() {
        return orderFoodDetailsList;
    }

    public void setOrderFoodDetailsList(List<OrderFoodDetails> orderFoodDetailsList) {
        this.orderFoodDetailsList = orderFoodDetailsList;
    }

    public List<CancelOrderFood> getCancelOrderFoodList() {
        return cancelOrderFoodList;
    }

    public void setCancelOrderFoodList(List<CancelOrderFood> cancelOrderFoodList) {
        this.cancelOrderFoodList = cancelOrderFoodList;
    }

    public Customers getCustomers() {
        return customers;
    }

    public void setCustomers(Customers customers) {
        this.customers = customers;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (oderFoodID != null ? oderFoodID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OderFood)) {
            return false;
        }
        OderFood other = (OderFood) object;
        if ((this.oderFoodID == null && other.oderFoodID != null) || (this.oderFoodID != null && !this.oderFoodID.equals(other.oderFoodID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.OderFood[oderFoodID=" + oderFoodID + "]";
    }

}
